Skip to content

Implement onAuxClick#56298

Draft
acoates-ms wants to merge 2 commits intofacebook:mainfrom
acoates-ms:auxclick
Draft

Implement onAuxClick#56298
acoates-ms wants to merge 2 commits intofacebook:mainfrom
acoates-ms:auxclick

Conversation

@acoates-ms
Copy link
Copy Markdown
Contributor

Summary:

Changelog:

Test Plan:

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 31, 2026
@github-actions
Copy link
Copy Markdown

Caution

Invalid Changelog Format

Please verify your Changelog format. See Changelog format

@github-actions
Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Apr 2, 2026
Port the shared changes from facebook#56298:
- Add onAuxClick/onAuxClickCapture to TouchEventEmitter (shared C++)
- Add AuxClick/AuxClickCapture to ViewEvents in primitives.h
- Add prop conversions in propsConversions.h
- Register topAuxClick as a bubbling event in BaseViewConfig.ios.js
- Add dispatch logic in RCTSurfacePointerHandler.mm (iOS path)
- Type onAuxClick as PointerEvent in PointerEventProps (Flow + TS)

Remove redundant macOS-specific JS registrations since macOS now
inherits the bubbling event from the iOS base config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Apr 8, 2026
Port the shared changes from facebook#56298:
- Add onAuxClick/onAuxClickCapture to TouchEventEmitter (shared C++)
- Add AuxClick/AuxClickCapture to ViewEvents in primitives.h
- Add prop conversions in propsConversions.h
- Register topAuxClick as a bubbling event in BaseViewConfig.ios.js
- Add dispatch logic in RCTSurfacePointerHandler.mm (iOS path)
- Type onAuxClick as PointerEvent in PointerEventProps (Flow + TS)

Remove redundant macOS-specific JS registrations since macOS now
inherits the bubbling event from the iOS base config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Saadnajmi added a commit to microsoft/react-native-macos that referenced this pull request Apr 9, 2026
## Summary
Backport of #2885 to 0.81-stable.

- Add `onAuxClick` event for right-click and middle-click handling on
macOS
- Add `onClick` event for left single-click on plain Views
- Fix `onAuxClick` prop registration in iterator-based setProp path
- Override `rightMouseDown:` to prevent context menu modal from stealing
`rightMouseUp:`
- Add `otherMouseDown:`/`otherMouseUp:` for middle-click support
- Prevent Pressable visual press feedback on non-primary mouse buttons
- Align with upstream facebook#56298 (shared cross-platform
changes)

## Test plan
- Left-click on View → fires `onClick` with `button=0`
- Double-click on View → fires `onDoubleClick` with `button=0`
- Right-click on View → fires `onAuxClick` with `button=2`
- Middle-click on View → fires `onAuxClick` with `button=1`
- Right-click on Pressable → fires `onAuxClick`, does NOT trigger
`onPress` or visual press state

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Saadnajmi added a commit to microsoft/react-native-macos that referenced this pull request Apr 9, 2026
## Summary
- Implements `onAuxClick` event, matching the upstream implementation in
[facebook#56298](facebook#56298)
- **Shared changes (from upstream):** Adds
`onAuxClick`/`onAuxClickCapture` to `TouchEventEmitter`, `ViewEvents`
(`primitives.h`), `propsConversions.h`, `BaseViewConfig.ios.js`
(bubbling event), `RCTSurfacePointerHandler.mm` (iOS dispatch), and
`PointerEventProps` types
- **macOS-specific changes:** Since macOS doesn't use
`RCTSurfacePointerHandler.mm` (guarded with `#if !TARGET_OS_OSX`), adds
native wiring through `RCTViewComponentView.mm` (`rightMouseUp:` →
`HostPlatformViewEventEmitter::onAuxClick`)
- Adds a `button` field to the macOS `MouseEvent` struct (W3C spec:
0=left, 1=middle, 2=right)
- Filters non-primary button clicks from triggering `onPress` in
`Pressability`, so right-clicking a `Pressable` no longer fires its
press handler

## Test plan

Event log matches my button presses

<img width="939" height="966" alt="Screenshot 2026-04-08 at 3 38 45 PM"
src="https://github.com/user-attachments/assets/a31c01d4-bfa1-440e-998d-bfd194b6f2f7"
/>




🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant